remotemanager.storage.database module¶
- class remotemanager.storage.database.Database(file)[source]¶
Database file handler for use in the Dataset.
Warning
Interacting with this object directly could cause unstable behaviour. It is best to allow Dataset to handle the Database
- Parameters:
file (str) – filename to write to
- update(payload)[source]¶
Update the database with payload (dict)
- Parameters:
payload (dict) – Dictionary to recursively update with. Usually called with the output of object.pack()
- property path¶
Path to current database file
- property tree: list¶
Returns a list of path-like strings for the stored database dict
- Returns (list):
List of path-like strings
- climb(data: dict, branch: list = None) list [source]¶
“climb” a dictionary tree, returning a list of path-like strings for each element
Note
This method is intended for use within the tree property, and could cause unintended behaviour if called directly, though will allow you to produce a tree like list for any dictionary. Use with caution.
- Parameters:
data (dict) – dictionary to treat
branch (list) – current branch, used for recursion
- Returns (list):
list of path-like strings
- remotemanager.storage.database.chain_get(d: dict, keys: list)[source]¶
Get item from a nested dict using a list of keys
- Parameters:
d (dict) – nested dict to query
keys (list) – list of keys to use
- Returns:
item from nested dict d at [list, of, keys]
- remotemanager.storage.database.check_version_barriers(old: Version, new: Version, barriers: dict) bool [source]¶
Takes two versions, and a dict of {old: new} that contain breaking changes
Returns True if the two versions are compatible, False otherwise
- Parameters:
old – old version
new – new version
barriers –
dictionary of incompatible {old: new} parings.
Uses the syntax of Version.match